package com.starry.push.netty.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.stereotype.Service;

import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.starry.push.netty.domain.SystemPersonnel;
import com.starry.push.netty.mapper.SystemPersonnelMapper;

/**
 * @author  WuChao
 * @date  2020/11/3 14:22
 * @version 1.0
 */
@Service
public class SystemPersonnelServiceImpl extends ServiceImpl<SystemPersonnelMapper, SystemPersonnel> implements SystemPersonnelService{

    @Override
    public int updateBatch(List<SystemPersonnel> list) {
        return baseMapper.updateBatch(list);
    }
    @Override
    public int updateBatchSelective(List<SystemPersonnel> list) {
        return baseMapper.updateBatchSelective(list);
    }
    @Override
    public int batchInsert(List<SystemPersonnel> list) {
        return baseMapper.batchInsert(list);
    }
    @Override
    public int insertOrUpdate(SystemPersonnel record) {
        return baseMapper.insertOrUpdate(record);
    }
    @Override
    public int insertOrUpdateSelective(SystemPersonnel record) {
        return baseMapper.insertOrUpdateSelective(record);
    }

    @Override
    public Boolean checkAuthentication(String clientType, String accessKey, String accessSecret) {
        SystemPersonnel one = baseMapper.selectOne(new QueryWrapper<SystemPersonnel>()
                .eq(SystemPersonnel.COL_CLIENT_TYPE, clientType)
                .eq(SystemPersonnel.COL_ACCESS_KEY, accessKey)
                .eq(SystemPersonnel.COL_ACCESS_SECRET, accessSecret)
        );
        return one != null;
    }
}
